<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>自定义组件的v-model</h1>
    <p>相当于子组件有一个value的props</p>
    <p>子组件触发了@input事件</p>
    <template id="temp">
        <div>
            <input v-model="value">
            <span>子组件值：{{value}}</span>
        </div>
    </template>
    <main id="app">
        <p>父组件值： {{value}}</p>
        <my-com v-model="value"></my-com>
    </main>
</body>
<script src="../vue.js "></script>
<script>
    new Vue({
        el: "#app",
        data() {
            return {
                value: "汽车",
            }
        },
        methods: {
        },
        components: {
            "my-com": {
                props: ["value"],
                template: "#temp",
            }
        }
    })
</script>

</html>